<!--
 * createor: zc
 * email: zc8023zs@163.com
 * create_time: 2020/3/14 13:46:24
 *-->
<template>
  <el-container>
    <el-header>
      会员等级详情
    </el-header>
    <el-main>
      <el-form label-width="200px" :inline="true" style="padding:5% 5% 0 5%">
        <el-form-item label="编号：">
          <span>{{formData.id}}</span>
        </el-form-item>
        <el-form-item label="等级名称：">
          <span>{{formData.grade_title}}</span>
        </el-form-item>
        <el-form-item label="购买价格：">
          <span>{{formData.buy_price}}</span>
        </el-form-item>
        <el-form-item label="有效时长N天：">
          <span>{{formData.available_day}}</span>
        </el-form-item>
        <el-form-item label="图标：">
          <span>{{formData.icon_url}}</span>
        </el-form-item>
        <el-form-item label="排序：">
          <span>{{formData.ordernum}}</span>
        </el-form-item>
        <el-form-item label="会员等级标签：">
          <span>{{formData.tag}}</span>
        </el-form-item>
        <el-form-item label="1正常 0禁用：">
          <span>{{formData.isok}}</span>
        </el-form-item>
        <el-form-item label="添加时间：">
          <span>{{formData.addtime}}</span>
        </el-form-item>
      </el-form>
    </el-main>
  </el-container>
</template>
<style scoped>
body .app-container .el-container,
body .app-container .el-header,
body .app-container .el-main,
body .el-container,
body .el-header,
body .el-main {
  padding: 0;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
</style>
<script>
import { Loading } from "element-ui";
import {
  jbr_user_gradeInfo
} from '@/api/project/wmyh/project_wmyh_jbr_user_grade'
export default {
  name: "a_wmyha_jbr_user_grade_info",
  data() {
    return {
      infoLoading: false,
      formData:{
        id: 0, 
        grade_title: '', 
        buy_price: 0, 
        available_day: 0, 
        icon_url: '', 
        ordernum: 0, 
        tag: '', 
        isok: 0, 
        addtime: '2020/8/11 10:52:37', 
      }
    };
  },
  activated() {
    var result = location.search.match(new RegExp("[\?\&]id=([^\&]+)", "i"));
    if(result != null || result.length > 0){
      this.onInfo(result[1]);
    }
  },
  methods: {
    onInfo(id){
      this.infoLoading=true;
      jbr_user_gradeInfo({id:id}).then(r=>{
        this.formData.id = r.dataSingle.id, 
        this.formData.grade_title = r.dataSingle.grade_title, 
        this.formData.buy_price = r.dataSingle.buy_price, 
        this.formData.available_day = r.dataSingle.available_day, 
        this.formData.icon_url = r.dataSingle.icon_url, 
        this.formData.ordernum = r.dataSingle.ordernum, 
        this.formData.tag = r.dataSingle.tag, 
        this.formData.isok = r.dataSingle.isok, 
        this.formData.addtime = r.dataSingle.addtime, 
        this.infoLoading=false;
      }).catch(()=>{
        this.infoLoading=false;
      });
    }
  }
}
</script>
